﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

	<Style x:Key="KeyFrameSliderThumbStyle" TargetType="{x:Type Thumb}">
		<Setter Property="SnapsToDevicePixels" Value="true"/>
		<Setter Property="OverridesDefaultStyle" Value="true"/>
		<Setter Property="Height" Value="36"/>
		<Setter Property="Width" Value="9"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Thumb}">
					<Canvas>
						<Rectangle Canvas.Top="0" Canvas.Left="0" Width="9" Height="14"
						Name="Ellipse" 
						Fill="{DynamicResource BrightVerticalGradientInverted}"
						Stroke="{DynamicResource DarkBrush}"
						StrokeThickness="1" />
						<Path Canvas.Top="0" Canvas.Left="0" Stroke="{DynamicResource DarkBrush}" StrokeThickness="1" StrokeDashArray="2,1">
							<Path.Data>
								<LineGeometry StartPoint="4,14" EndPoint="4,36"/>
							</Path.Data>
						</Path>
					</Canvas>
					<ControlTemplate.Triggers>
						<Trigger Property="IsMouseOver" Value="True">
							<Setter TargetName="Ellipse" Property="Fill" Value="{DynamicResource HighlightVerticalGradientInverted}"/>
						</Trigger>
						<Trigger Property="IsEnabled" Value="false">
							<Setter TargetName="Ellipse" Property="Fill" Value="{DynamicResource BaseBrush}"/>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<ControlTemplate x:Key="HorizontalSlider" TargetType="{x:Type Slider}">
		<Grid>
			<Grid.RowDefinitions>
				<RowDefinition Height="Auto"/>
				<RowDefinition Height="Auto" MinHeight="{TemplateBinding Slider.MinHeight}"/>
				<RowDefinition Height="Auto"/>
			</Grid.RowDefinitions>
			<TickBar 
      Name="TopTick"
      SnapsToDevicePixels="True" 
      Placement="Top"
      Fill="{DynamicResource DarkBrush}"
      Height="4"
      Visibility="Collapsed" />
			<Track Grid.Row="1" Name="PART_Track">
				<Track.Thumb>
					<Thumb Style="{StaticResource KeyFrameSliderThumbStyle}" />
				</Track.Thumb>
			</Track>
			<TickBar 
      Name="BottomTick"
      SnapsToDevicePixels="True" 
      Grid.Row="2"
      Fill="{TemplateBinding Foreground}"
      Placement="Bottom"
      Height="4"
      Visibility="Collapsed" />
		</Grid>
		<ControlTemplate.Triggers>
			<Trigger Property="TickPlacement" Value="TopLeft">
				<Setter TargetName="TopTick" Property="Visibility" Value="Visible"/>
			</Trigger>
			<Trigger Property="TickPlacement" Value="BottomRight">
				<Setter TargetName="BottomTick" Property="Visibility" Value="Visible"/>
			</Trigger>
			<Trigger Property="TickPlacement" Value="Both">
				<Setter TargetName="TopTick" Property="Visibility" Value="Visible"/>
				<Setter TargetName="BottomTick" Property="Visibility" Value="Visible"/>
			</Trigger>
		</ControlTemplate.Triggers>
	</ControlTemplate>

	<ControlTemplate x:Key="KeyFrameVerticalSlider" TargetType="{x:Type Slider}">
		<Grid>
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="Auto"/>
				<ColumnDefinition Width="Auto" MinWidth="{TemplateBinding Slider.MinWidth}"/>
				<ColumnDefinition Width="Auto"/>
			</Grid.ColumnDefinitions>
			<TickBar 
      Name="TopTick"
      SnapsToDevicePixels="True" 
      Placement="Left"
      Fill="{DynamicResource DarkBrush}"
      Width="4"
      Visibility="Collapsed" />
			<Track Grid.Column="1" Name="PART_Track">
				<Track.Thumb>
					<Thumb Style="{StaticResource KeyFrameSliderThumbStyle}" />
				</Track.Thumb>
			</Track>
			<TickBar 
      Name="BottomTick"
      SnapsToDevicePixels="True" 
      Grid.Column="2"
      Fill="{TemplateBinding Foreground}"
      Placement="Right"
      Width="4"
      Visibility="Collapsed" />
		</Grid>
		<ControlTemplate.Triggers>
			<Trigger Property="TickPlacement" Value="TopLeft">
				<Setter TargetName="TopTick" Property="Visibility" Value="Visible"/>
			</Trigger>
			<Trigger Property="TickPlacement" Value="BottomRight">
				<Setter TargetName="BottomTick" Property="Visibility" Value="Visible"/>
			</Trigger>
			<Trigger Property="TickPlacement" Value="Both">
				<Setter TargetName="TopTick" Property="Visibility" Value="Visible"/>
				<Setter TargetName="BottomTick" Property="Visibility" Value="Visible"/>
			</Trigger>
		</ControlTemplate.Triggers>
	</ControlTemplate>

	<Style x:Key="KeyFrameSliderStyle" TargetType="{x:Type Slider}">
		<Setter Property="SnapsToDevicePixels" Value="true"/>
		<Setter Property="OverridesDefaultStyle" Value="true"/>
		<Style.Triggers>
			<Trigger Property="Orientation" Value="Horizontal">
				<Setter Property="MinWidth" Value="104" />
				<Setter Property="MinHeight" Value="21" />
				<Setter Property="Template" Value="{StaticResource HorizontalSlider}" />
			</Trigger>
			<Trigger Property="Orientation" Value="Vertical">
				<Setter Property="MinWidth" Value="21" />
				<Setter Property="MinHeight" Value="104" />
				<Setter Property="Template" Value="{StaticResource VerticalSlider}" />
			</Trigger>
		</Style.Triggers>
	</Style>

</ResourceDictionary>